import vc from '@/assets/scss/mapVariables.less';
export const colorMap = {
  defaultBlue: vc.defaultColor, // @base-color-default: #3c98ff; 
  areaDefaultBackaground: '#1d599d', // 地块默认底色
  areaMainBorder: '#ffffff', // 地块主边界线
  areaOutline: '#bddcff' // 地块内部子边界线

};
export const zhejiangProvinceAdInfo = {
  id: 1,
  adcode: 330000,
  zoom: 6.7,
  name: '浙江省',
  center: [120.5476850915461, 29.10108157663211],
  centroid: [120.109913, 29.181466],
  childrenNum: 11,
  level: 'province',
  acroutes: [100000],
  parent: { adcode: 100000 }
};
// adcode: 330000, name: '浙江省',  前三
// adcode: 330100, name: '杭州市',  前四
// adcode: 330602, name: '越城区'   前六
// 省 市 的zoom center 本地配置
export const zoomMap = {
  // 1: { zoom: zhejiangProvinceAdInfo.zoom, center: { lng: zhejiangProvinceAdInfo.center[0], lat: zhejiangProvinceAdInfo.center[1] } },
  // 2: { zoom: 7.897480865845365, center: { lng: 119.47285389753392, lat: 29.80665270719915 } },
  // 16: { zoom: 8.117984692676306, center: { lng: 121.47710276887415, lat: 29.68312432371299 } },
  // 27: { zoom: 8.156802015732383, center: { lng: 120.49728568493532, lat: 27.840524277285596 } },
  // 40: { zoom: 9.000000000000016, center: { lng: 120.7615039508027, lat: 30.624946119480356 } },
  // 48: { zoom: 8.558992346338155, center: { lng: 119.84215660806939, lat: 30.70513204747867 } },
  // 54: { zoom: 8.558992346338162, center: { lng: 120.62908123707314, lat: 29.72935872082185 } },
  // 61: { zoom: 8.377305842563311, center: { lng: 119.91849824531198, lat: 29.078081815979843 } },
  // 71: { zoom: 8.377305842563311, center: { lng: 118.61506874552038, lat: 28.822006986265563 } },
  // 78: { zoom: 8.117984692676306, center: { lng: 122.15482826666397, lat: 30.188175234936494 } },
  // 83: { zoom: 8.156802015732383, center: { lng: 121.13931078386486, lat: 28.62742681896782 } },
  // 93: { zoom: 8.156802015732383, center: { lng: 119.51262701887231, lat: 28.137208819368837 } }
};
export const sourcesMap = {
  tianditu: {
    type: 'raster',
    tiles: [
      'http://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f',
      'http://t1.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f',
      'http://t2.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f',
      'http://t4.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f',
      'http://t5.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f',
      'http://t6.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f',
      'http://t3.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f ',
      'http://t7.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=2d8eca459ee67a4b8d1f281791d4f09f'
    ],
    tileSize: 256
  },
  focuseArea: {
    type: 'geojson',
    data: null
  },
  focuseAreaName: {
    type: 'geojson',
    data: null
  },
  focuseBorder: {
    type: 'geojson',
    data: null
  },
  // focuseLabels: {
  //   type: 'geojson',
  //   data: null
  // },
  // 天眼 需要api请求第三方
  skyEyes: { type: 'geojson', data: null },
  // 受灾理赔
  payment: { type: 'geojson', data: null },
  // 虫情
  bugs: { type: 'geojson', data: null },
  // 社会化服务组织
  orgService: { type: 'geojson', data: null },
  //  土壤 涉农气象站
  terminals: { type: 'geojson', data: null },
  // 生产任务 进度 预警
  plantsSource: { type: 'geojson', data: null }

  // border: {
  // 焦点区域
  //   type: 'geojson',
  //   data: '@/assets/mapDatas/mapDatas/border.json'
  // },
};
export const baseLayers = [
  {
    id: 'tianditu',
    type: 'raster',
    source: 'tianditu',
    minzoom: 6,
    maxzoom: 18,
    layout: {
      visibility: 'none'
    }
  },
  {
    id: 'focuseAreaLayer',
    beforeId: false,
    type: 'fill',
    source: 'focuseArea',
    layout: {
      // visibility: 'none'
    },
    paint: {
      'fill-color': colorMap.areaDefaultBackaground,
      'fill-opacity': 0.3,
      'fill-outline-color': colorMap.areaOutline
    }
  },
  {
    id: 'focuseAreaNameLayer',
    beforeId: false,
    type: 'symbol',
    source: 'focuseAreaName',
    layout: {
      'text-field': ['get', 'name'],
      'text-anchor': 'bottom',
      'text-offset': [0, -0.2],
      // 'symbol-avoid-edges': true,
      // 'symbol-placement': 'line-center',
      'text-allow-overlap': true,
      'text-size': 12
    },
    paint: {
      'text-color': '#ffffff',
      'text-halo-width': 2,
      'text-halo-blur': 0,
      'text-halo-color': '#0D2341'
    }
  },
  {
    id: 'focuseBorderLayer',
    beforeId: false,
    type: 'line',
    source: 'focuseBorder',
    layout: {},

    paint: {
      'line-color': colorMap.areaMainBorder,
      'line-width': 2
    }
  }
];
